package adv2;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class ArrTest2 {

	public static void main(String[] args) {
		// String数组排序
		String[] ar = { "老吴", "Xiaozhang", "华伟成", "老宋", "小吴" };
		System.out.println(Arrays.toString(ar));
		Arrays.sort(ar);
		System.out.println(Arrays.toString(ar));

		// 复杂对象的排序
		Yuangong[] yg = { new Yuangong("小吴", 52, "男", "副总", 6700, "hf001"),
				new Yuangong("小张", 23, "男", "门卫", 2300, "hf002"), new Yuangong("老刘", 29, "男", "司机", 19000, "hf003"),
				new Yuangong("老宋", 32, "男", "办公室主任", 5600, "hf004") };
//		Arrays.sort(yg);
//		System.out.println("排序之后：");
//		for (Yuangong g : yg) {
//			System.out.println(g);
//		}
		List<Yuangong> list = Arrays.asList(yg);
		Yuangong max = Collections.max(list);
		System.out.println("最大是：" + max);
	}

}
